home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Champak 138
/
Volume 138 Aug 19 2011 - Damaged.iso
/
Games
/
shadez.swf
/
scripts
/
Local
/
Draw
/
CExplodeBMDParticle.as
< prev
next >
Wrap
Text File
|
2011-08-19
|
5KB
|
163 lines
package Local.Draw
{
import flash.display.BitmapData;
import flash.filters.BlurFilter;
import flash.geom.Matrix;
import flash.geom.Point;
import flash.geom.Rectangle;
public class CExplodeBMDParticle
{
public static var mAllocateID:int = 0;
public static var mWorldPosition:Point;
public static var mKillHeight:int;
public static var mParticleSize:Number = 15;
public static var mDefaultParticleSize:Number = 8;
public static const zPoint:Point;
{
if(true)
{
zPoint = new Point(0,0);
if(true)
{
mDefaultParticleSize = 8;
if(true)
{
mParticleSize = 15;
}
mAllocateID = 0;
}
mWorldPosition = new Point(0,0);
}
}
public var mID:String;
public var mInvalid:Boolean;
private var mDelta:Point;
private var mBMD:BitmapData;
public var Process:Function;
private var mDispMatrix:Matrix;
private var mDeltaRadians:Number;
private var mDrawMatrix:Matrix;
public var Render:Function;
public var mDrawn:Boolean;
public function CExplodeBMDParticle(param1:BitmapData, param2:Rectangle, param3:Matrix, param4:Point = null)
{
var _loc5_:BitmapData = null;
var _loc6_:Rectangle = null;
var _loc7_:Number = NaN;
super();
(_loc5_ = new BitmapData(Math.ceil(param2.width + 4),Math.ceil(param2.height + 4),true,0)).copyPixels(param1,param2,new Point(2,2));
if(!((_loc6_ = _loc5_.getColorBoundsRect(4278190080,0,false)).width && _loc6_.height))
{
mInvalid = true;
return;
}
mBMD = _loc5_;
mBMD.applyFilter(mBMD,mBMD.rect,zPoint,new BlurFilter(2,2,1));
mDispMatrix = new Matrix(1,0,0,1,-(_loc6_.x + _loc6_.width / 2),-(_loc6_.y + _loc6_.height / 2));
mDrawMatrix = new Matrix(1,0,0,1,param2.x + _loc6_.width / 2,param2.y + _loc6_.height / 2);
mDrawMatrix.concat(param3);
mDrawMatrix.tx += mWorldPosition.x;
mDrawMatrix.ty += mWorldPosition.y;
mDelta = new Point(Math.random() * 40 - 20,-Math.random() * 40);
_loc7_ = Math.min(1,mParticleSize / mDefaultParticleSize);
mDelta.x *= _loc7_;
mDelta.y *= _loc7_;
if(param4)
{
mDelta = mDelta.add(param4);
}
mID = "P" + ++mAllocateID;
if(mParticleSize < 4)
{
Process = Process_NoSpin;
Render = Render_NoSpin;
}
else
{
mDeltaRadians = Math.random() * 3 - 1.5;
Process = Process_Spin;
Render = Render_Spin;
}
}
public function Process_NoSpin() : Boolean
{
mDelta.x *= 0.99;
mDelta.y = mDelta.y * 0.99 + 1;
mDrawMatrix.tx += mDelta.x;
mDrawMatrix.ty += mDelta.y;
§§push(mDrawMatrix.ty >= mKillHeight);
if(true)
{
§§push(!§§pop());
}
return §§pop();
}
public function Process_Spin() : Boolean
{
if(true)
{
mDelta.x *= 0.99;
if(true)
{
mDelta.y = mDelta.y * 0.99 + 1;
if(true)
{
§§push(§§findproperty(mDeltaRadians));
§§push(mDeltaRadians);
if(true)
{
§§push(§§pop() * 0.95);
}
§§pop().mDeltaRadians = §§pop();
mDispMatrix.rotate(mDeltaRadians);
}
mDrawMatrix.tx += mDelta.x;
}
mDrawMatrix.ty += mDelta.y;
}
return mDrawMatrix.ty < mKillHeight;
}
public function Render_Spin(param1:BitmapData) : void
{
var _loc2_:Matrix = null;
_loc2_ = mDispMatrix.clone();
_loc2_.concat(mDrawMatrix);
_loc2_.tx -= mWorldPosition.x;
_loc2_.ty -= mWorldPosition.y;
param1.draw(mBMD,_loc2_);
}
public function Render_NoSpin(param1:BitmapData) : void
{
param1.copyPixels(mBMD,mBMD.rect,new Point(mDispMatrix.tx + mDrawMatrix.tx - mWorldPosition.x,mDispMatrix.ty + mDrawMatrix.ty - mWorldPosition.y),null,null,true);
}
public function Dispose() : void
{
mBMD.dispose();
}
}
}